package com.yitiao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yitiao.entity.CommerceGoods;
import java.util.List;
import java.util.Optional;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CommerceGoodsMapper extends BaseMapper<CommerceGoods> {
    int batchInsert(@Param("list") List<CommerceGoods> list);

    @Update("update t_commerce_goods set inventory = inventory - #{de} where goods_name = #{goodName} and inventory >= #{de}")
    int deStockByUpdate(@Param("goodName") String goodName, @Param("de") int de);
}